pluginHome = new File("./plugins").listFiles().find { it.name.startsWith('cloud-tools-')}
if(pluginHome == null) pluginHome = "."

includeTargets << new File( "${pluginHome}/scripts/CloudToolsInit.groovy" )

target('default': "takes a snapshot of the EBS volume") {
	snapShot()
}


target(snapShot: "The implementation task") {
	depends( initCloudToolsService)
    cloudToolsService.withCluster { clusterManager, clusterName, cluster ->
		def snapshotId = cluster.getClusterInstance().getDatabaseTier().snapshotDatabase();
		event("StatusFinal", ["Snapshot created: ${snapshotId}"])
	}
}
